import request from '@/config/axios'
import {PaymentBatchVO} from "@/api/dispatch/paymentbatch";

// 派单批量收款单 VO
export interface ReceiptBatchVO {
  id: number // 订单编号
  dispatchReceiptIds: string // 收款编号集合
  amount: number // 合计金额
  receiptAmount: number // 已收金额
  channelName: string // 渠道名称
  remark: string // 备注
  status: number // 开启状态
  sort: number // 排序
}

// 派单批量收款单 API
export const ReceiptBatchApi = {
  // 查询派单批量收款单分页
  getReceiptBatchPage: async (params: any) => {
    return await request.get({ url: `/dispatch/receipt-batch/page`, params })
  },

  // 查询派单批量收款单详情
  getReceiptBatch: async (id: number) => {
    return await request.get({ url: `/dispatch/receipt-batch/get?id=` + id })
  },

  updateReceiptAmount: async (data: PaymentBatchVO) => {
    return await request.put({ url: `/dispatch/receipt-batch/updateReceiptAmount`, data })
  },

  // 新增派单批量收款单
  createReceiptBatch: async (data: ReceiptBatchVO) => {
    return await request.post({ url: `/dispatch/receipt-batch/create`, data })
  },

  // 修改派单批量收款单
  updateReceiptBatch: async (data: ReceiptBatchVO) => {
    return await request.put({ url: `/dispatch/receipt-batch/update`, data })
  },

  // 删除派单批量收款单
  deleteReceiptBatch: async (id: number) => {
    return await request.delete({ url: `/dispatch/receipt-batch/delete?id=` + id })
  },

  // 导出派单批量收款单 Excel
  exportReceiptBatch: async (params) => {
    return await request.download({ url: `/dispatch/receipt-batch/export-excel`, params })
  },
}
